#include <bits/stdc++.h>
using namespace std;

#define int long long

const int N = 2e5+5;
int n,q; 
int a[N], tr[N];

int lowbit(int x){
    return x & (-x);
}

void add(int x, int k){
    for ( ; x<=n; x+=lowbit(x) ) tr[x] += k;
}

int sum(int x){
    int res = 0;
    for ( ; x>=1; x-=lowbit(x) ) res += tr[x];
    return res;
}

signed main(){
    cin >> n >> q;
    for ( int i=1; i<=n; i++ ) {
        cin >> a[i];
        add(i,a[i]);
    }

    for ( int i=1; i<=q; i++ ) {
        int op; cin >> op;
        if ( op==1 ){
            int k,v; cin >> k >> v;
            add(k,v);
        } else {
            int l,r; cin >> l >> r;
            cout << sum(r) - sum(l-1) << '\n';
        }
    }

    return 0;

}


